<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
  <c:choose>
   
     <c:when test="${selectedProductList.size()>0}">
       <c:set var="total" value="0"  ></c:set>
       <form action="RemoveFromCart">
         <table>
     <thead> <tr><th>Product Id </th>
        <th>Product Name</th>
         <th>Quantity </th>
         <th>Price</th>
          <th>Remove</th>
          </tr>
          </thead>
          <c:forEach var="productDetails" items="${selectedProductList}">
           <tr>
            <td>${productDetails.productId}</td>
            <td>${productDetails.productName}</td>
           <td>${productDetails.quantity}</td>
            <td>${productDetails.price}</td>
           <td><input type="checkbox" name="productId" value="${productDetails.productId}">
           </td>
            <c:set  var="total" value="${total + productDetails.price}"></c:set>
          </c:forEach>      
         <tr><td></td>
         <td></td>
         <td>Total =  <c:out value="${total}"  escapeXml="true" ></c:out> </td>
         <td></td>
         <td></td></tr>
         
         </table>
         <input type="submit" value="Remove from cart">
         </form>
     </c:when>
     <c:otherwise>
        your cart is empty
        <a href="welcome.jsp">click to view the List of products</a>
     </c:otherwise>
  
  </c:choose>


</body>
</html>